//Francisco "Kiko" Olvera
//Power up "WallPass"
//Allows the player to move through 1 wall
//PUWallPass.h

#include "PUWallPass.h"
#include "input.h"
#include "ENUM.h"
#include "Controller.h"


PUWallPass::PUWallPass()
{
	PU_name = "Go Through Walls Power-Up";
}
int PUWallPass::Execute(Input* input, Player* player, Text * text)
{
	bool used = false;
	Controller::Instance()->getBoard()->setCurrentTile(player->getCurrentTile());
	//player movement

	//Set font object for this power-up
	text->setText("MOVE PLAYER, HOWEVER YOU CAN MOVE THROUGH A WALL!\n"
				  "Hold <CTRL> for help.");
	if(input->KeyDown(DIK_LCONTROL) || input->KeyDown(DIK_RCONTROL))
	{
		text->setText(	"* Use <SHIFT> keys to look at your current goal.\n"
						"* Use WASD to move player.\n"
						"* You may pass through one wall unrestricted.\n"
						"* Use <SPACE> to set player position and end turn.\n");
	}

	if(input->KeyPressed(DIK_W) || input->KeyPressed(DIK_UP))
	{
		if(!player->MoveNorth() && !used)
		{
			player->ForceMoveNorth();
			used = true;
		}
	}
	if(input->KeyPressed(DIK_A) || input->KeyPressed(DIK_LEFT))
	{
		if(!player->MoveWest() && !used)
		{
			player->ForceMoveWest();
			used = true;
		}
	}
	if(input->KeyPressed(DIK_S) || input->KeyPressed(DIK_DOWN))
	{
		if(!player->MoveSouth() && !used)
		{
			player->ForceMoveSouth();
			used = true;
		}
	}
	if(input->KeyPressed(DIK_D) || input->KeyPressed(DIK_RIGHT))
	{
		if(!player->MoveEast() && !used)
		{
			player->ForceMoveEast();
			used = true;
		}
	}
	if(input->KeyPressed(DIK_SPACE))
	{
		player->Collect();
		return NOMOVE;
	}
	return STAY;
}